package com.umgsai.thread.thread56;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.plaf.synth.SynthStyleFactory;

public class Main2 {
	static public class MyTask extends TimerTask{

		@Override
		public void run() {
			System.out.println("执行时间：" + new Date());
		}
	}
	public static void main(String[] args) throws ParseException {
		Timer timer = new Timer();
		MyTask task = new MyTask();
		System.out.println("当前时间：" + new Date());
		timer.schedule(task, 5000, 2000);
	}
}
